﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BoxScore.Home
{
    public partial class Contacto : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            this.Editor1.Content = "";
            Response.Redirect("~/Home/Index.aspx");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            System.Net.Mail.MailMessage correo = new System.Net.Mail.MailMessage();
            correo.From = new System.Net.Mail.MailAddress(txtemailfrom.Text);
            correo.To.Add("contacto@boxscore.com");
            correo.Subject = this.txtsubject.Text;

            string bodyMail = "\n\nFecha y hora GMT: " +
                DateTime.Now.ToUniversalTime().ToString("dd/MM/yyyy HH:mm:ss");

            correo.Body = bodyMail + "<br / ><br / >" + Editor1.Content;
            correo.IsBodyHtml = true;
            correo.Priority = System.Net.Mail.MailPriority.Normal;
            //
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
            //
            //---------------------------------------------
            // Estos datos debes rellanarlos correctamente
            //---------------------------------------------
            //smtp.Host = "servidor de correo";
            // smtp.Credentials = new System.Net.NetworkCredential("usuario", "password");
            //smtp.EnableSsl = false;
            try
            {
                smtp.Send(correo);
                //LabelError.Text = "Mensaje enviado satisfactoriamente";
                this.Editor1.Content = "";
            }
            catch (Exception ex)
            {
                //LabelError.Text = "ERROR: " + ex.Message;
            }

            
        }
    }
}
